package com.example.shujujiexi.JsonString;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.springframework.util.StringUtils;
//import net.sf.json.JSONObject;

public class test {

    public static void main(String[] args) {


        String str="{\"UNI_BSS_HEAD\":{\"TRANS_ID\":\"20190813155116522499827\",\"TIMESTAMP\":\"2019-08-13 15:51:16 522\",\"APP_ID\":\"w7iGtz3g9h\",\"TOKEN\":\"1e5020df8c1eef84d630bef53d2fb671\"},\"UNI_BSS_ATTACHED\":{\"MEDIA_INFO\":\"\"},\"UNI_BSS_BODY\":{\"INTROAMINFOOPEN_REQ\":{\"effectivetime\":\"20190824000000\",\"dealtime\":\"20190814111236\",\"userid\":\"1118091638138216\",\"ordertype\":\"0\",\"agentname\":\"宽带在线测试\",\"ineffectivetime\":\"20190824235959\",\"agentid\":\"KDZXCS\",\"citycode\":\"110\",\"resourcecout\":\"\",\"provincecode\":\"11\",\"productid\":\"IOP00003\",\"nettype\":\"11\",\"pay\":\"26.0\",\"regioncode\":\"\",\"orderid\":\"dg156566595410748\",\"imsi\":\"460012001648150\",\"usernumber\":\"18612003948\"}}}";
        String str1="{\"UNI_BSS_HEAD\":{\"RESP_DESC\":\"Success\"|\"TRANS_ID\":\"20190813155116522499827\"|\"TIMESTAMP\":\"2019-08-13 15:51:16 522\"|\"RESP_CODE\":\"00000\"|\"APP_ID\":\"w7iGtz3g9h\"}|\"UNI_BSS_ATTACHED\":{\"MEDIA_INFO\":\"\"}|\"UNI_BSS_BODY\":{\"INTROAMINFOOPEN_RSP\":{\"STATUS\":\"0000\"|\"MSG\":\"服务调用成功！\"|\"TXID\":\"c3f81038fc06^1564141553472^285258\"|\"RSP\":{\"RSP_CODE\":\"0000\"|\"RSP_DESC\":\"执行成功!\"|\"SUB_CODE\":\"0000\"|\"SUB_DESC\":\"执行成功!\"|\"DATA\":[{\"orderstatus\":\"2\"|\"failedcode\":\"8888\"|\"failedreason\":\"订单已订购！来源订单号为：dg156566595410748的订单已经存在！\"|\"orderid\":\"\"|\"ioporderid\":\"\"|\"iopdealtime\":\"\"}]}}}}";
        String str2= StringUtils.replace(str1,"|",",");
        JSONObject jsonObject= JSON.parseObject(str2);
        JSONObject jsonObject1=jsonObject.getJSONObject("UNI_BSS_ATTACHED");
        JSONObject jsonObject2=jsonObject.getJSONObject("UNI_BSS_BODY");
        JSONObject jsonObject3=jsonObject2.getJSONObject("INTROAMINFOOPEN_RSP");
        JSONObject jsonObject4=jsonObject3.getJSONObject("RSP");
        JSONArray  jsonObject5=jsonObject4.getJSONArray("DATA");







        System.out.println(jsonObject);
        System.out.println(jsonObject1);
        System.out.println(jsonObject2);
        System.out.println(jsonObject3);
        System.out.println(jsonObject4);
        System.out.println(jsonObject5);


    }
}
